package model;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;

public class Line extends Shape {

    private int x2;
    private int y2;

    public Line(int x, int y, int x2, int y2, int stroke, Color stroke_color) {
	super(x, y, stroke, stroke_color);
	this.x2 = x2;
	this.y2 = y2;
    }

    public int getX2() {
	return x2;
    }

    public void setX2(int x2) {
	this.x2 = x2;
    }

    public int getY2() {
	return y2;
    }

    public void setY2(int y2) {
	this.y2 = y2;
    }

    @Override
    public void draw(Graphics g, float zoom_scale) {

	Graphics2D g2 = (Graphics2D) g;

	// Outline
	if (getStrokeColor() != null) {
	    g2.setStroke(new BasicStroke(getStrokeWidth()));
	    g.setColor(getStrokeColor());
	    g.drawLine((int) (getX() * zoom_scale),
		    (int) (getY() * zoom_scale), (int) (getX2() * zoom_scale),
		    (int) (getY2() * zoom_scale));
	}
    }

}
